<template>
    <a class="zgcard" @click.stop="checklogin(zlitem.fileaddress)">
        <div class="zgcard-img aligncenter" style="max-width: 60px;min-width: 60px;align-items: center;display: flex;">
            <van-icon class="icon" color="#f60" size="50" name="invition" />
        </div>
        <div class="zgcard-info">
            <p class="card-info-title">{{zlitem.filename}}</p>
            <p class="card-info-type" v-html="zlitem.filedetail"></p>
            <div class="zgcard-foot">
                <span class="user-avatar">{{zlitem.ksname}}</span>
                <span class="zgcard-foot-tip">
                    <a class="user-avatar-btn"></a>
                </span>
            </div>
        </div>
        <span class="zgcard-hot" v-if="zlitem.recommend">{{zlitem.recommend}}</span>
    </a>
</template>

<script>
    export default {
        props:{
            zlitem:{ type: Object, default: () => {} },
        },
        name: "zlcard",
        computed:{
            userdata(){
                return this.$store.getters.userdata ? this.$store.getters.userdata : '';
            },
        },
        methods: {
            checklogin(url) {
                var that = this
                if (!that.userdata) {
                    that.$dialog.confirm({
                        title: '提示', message: '请先登录', confirmButtonText: '前往登陆', cancelButtonText: '取消'
                    }).then(() => {
                        this.$router.push({ path: '/user/login' });
                    }).catch(() => {
                    });
                    return
                }
                window.location.href = url
            },
        }
    };
</script>

<style scoped>

</style>